package de.xt.logging.utils;

import java.io.File;

public class ProcessCheck extends Thread {

	public boolean isWindows;
	public File file;
	public String backupPath;
	public boolean backup;
	public String formating;
	public String pathToStorage;
	public String prefix;
	public boolean ooc;
	public boolean farbcode;
	public boolean loginNachrichten;
	public boolean party;
	public boolean pns;
	public boolean shouts;

	@Override
	public void run() {
		do {
			boolean isRunning = false;
			boolean hadRun = false;

			while (!isRunning) {
				isRunning = VBSUtils.isRunning(isWindows);
			}

			while (!hadRun) {
				hadRun = VBSUtils.isRunning(isWindows);
			}
			if (!VBSUtils.isRunning(isWindows) && hadRun) {
				CopyTask.copyLog(file, backup, backupPath, formating,
						pathToStorage, prefix, ooc, farbcode, loginNachrichten,
						party, pns, shouts);
				isRunning = false;
				hadRun = false;
			}
			try {
				Thread.sleep(2000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		} while (true);
	}

}
